package com.rongmei.jdsync.dto;

import lombok.Data;

@Data
public class BaseResponseDto<T> {
    private String code;
    private String message;
    private T data;

    public static <T> BaseResponseDto<T> success(T data) {
        BaseResponseDto<T> response = new BaseResponseDto<>();
        response.code = "200";
        response.message = "success";
        response.data = data;
        return response;
    }

    public static <T> BaseResponseDto<T> success(String message) {
        BaseResponseDto<T> response = new BaseResponseDto<>();
        response.code = "200";
        response.message = message;
        return response;
    }

    public static <T> BaseResponseDto<T> error(String message) {
        BaseResponseDto<T> response = new BaseResponseDto<>();
        response.code = "500";
        response.message = message;
        return response;
    }
}
